package com.juai.centralkitchen.activity;

import android.content.Intent;
import android.view.View;

import com.bridge.common.base.BaseActivity;
import com.bridge.common.dialog.ConfirmDialog;
import com.bridge.common.utils.ActivityUtil;
import com.bridge.common.utils.SpUtils;
import com.juai.centralkitchen.R;
import com.juai.centralkitchen.databinding.ActivitySettingBinding;

/**
 * @ClassName SetttingActivity
 * @Description TODO 设置
 * @Author biekangdong
 * @CreateDate 2021/5/13 14:53
 * @Version 1.0
 * @UpdateDate 2021/5/13 14:53
 * @UpdateRemark 更新说明
 */
public class SetttingActivity extends BaseActivity {
    ActivitySettingBinding binding;

    @Override
    protected int layoutId() {
        return R.layout.activity_setting;
    }

    @Override
    protected void initView() {
        binding=getBind();
    }

    @Override
    protected void setListenner() {
        binding.btnLogout.setOnClickListener(this);

        String account=SpUtils.getString(mContext,SpUtils.ACCOUNT,"");
        binding.tvAccount.setText(account);
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.btn_logout://退出登录
                ConfirmDialog confirmDialog=new ConfirmDialog(mContext,R.style.customer_dialog,"退出登录");
                confirmDialog.show();
                confirmDialog.setDialogViewListener(new ConfirmDialog.DialogViewListener() {
                    @Override
                    public void sureClick() {
                        SpUtils.putData(mContext,SpUtils.ISLOGIN,0);
                        SpUtils.putData(mContext,SpUtils.TOKEN,"");
                        ActivityUtil.finishAllActivity();
                        startActivity(new Intent(mContext,LoginActivity.class));
                    }
                });
                break;
        }
    }
}
